Skip to content

Conversation

jwilder
Copy link
Contributor

@jwilder jwilder commented Sep 16, 2025

Running the samples that use redis where workers are separate generates non-stop errors like the following:

2025/09/15 23:01:02 ERROR error polling task error="dequeueing task: NOGROUP No such key 'task-stream:system:activities' or consumer group 'task-workers' in XREADGROUP with GROUP option"

The original error occurred because:

  • The worker tries to recover abandoned tasks during startup using XAUTOCLAIM
  • This requires existing consumer groups for the Redis streams
  • Previously, consumer groups were only created when PrepareWorkflowQueues/PrepareActivityQueues were explicitly called
  • The recovery operations happened before queue preparation, causing NOGROUP errors

The fix ensures that consumer groups for the essential queues (default and system) are created automatically during Redis backend initialization, eliminating the race condition.

Running the samples that use redis where workers are separate generates non-stop errors
like the following:

2025/09/15 23:01:02 ERROR error polling task error="dequeueing task: NOGROUP No such key 'task-stream:system:activities' or consumer group 'task-workers' in XREADGROUP with GROUP option"

The original error occurred because:

* The worker tries to recover abandoned tasks during startup using XAUTOCLAIM
* This requires existing consumer groups for the Redis streams
* Previously, consumer groups were only created when PrepareWorkflowQueues/PrepareActivityQueues were explicitly called
* The recovery operations happened before queue preparation, causing NOGROUP errors

The fix ensures that consumer groups for the essential queues (default and _system_) are created automatically during Redis backend initialization, eliminating the race condition.
@cschleiden cschleiden force-pushed the jwilder/redis-backend branch from c53a377 to 521f2ce Compare September 20, 2025 05:00
// to prevent NOGROUP errors when the worker starts and tries to recover abandoned tasks
func (rb *redisBackend) ensureDefaultConsumerGroups(ctx context.Context) error {
// Initialize consumer groups for both default and system queues
queues := []workflow.Queue{workflow.QueueDefault, core.QueueSystem}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
queues := []workflow.Queue{workflow.QueueDefault, core.QueueSystem}
queues := []workflow.Queue{core.QueueDefault, core.QueueSystem}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants